const service = require("../services/product");

class Controller {
	async list(req, res) {
		res.json(await service.list(req.query));
	}
	async add(req, res) {
		res.json(await service.add(req.body));
	}
	async update(req, res) {
		res.json(await service.update(req.body));
	}
	async del(req, res) {
		res.json(await service.del(req.body));
	}

	async addLabel(req, res) {
		res.json(await service.addLabel(req.body));
	}

	async delLabel(req, res) {
		res.json(await service.delLabel(req.body));
	}

	async uploadImage(req, res) {
		res.json(await service.uploadImage(req));
	}

	async getProductByPosition(req, res) {
		res.json(await service.getProductByPosition(req.query));
	}

	async getProductByShopId(req, res) {
		res.json(await service.getProductByShopId(req.query));
	}

	async getProductById(req, res) {
		res.json(await service.getProductById(req.query));
	}
}

module.exports = new Controller();
